package pers.vic.practice.module.student.service;

import org.springframework.stereotype.Service;
import pers.vic.boot.base.service.BaseService;
import pers.vic.practice.module.student.mapper.SCourseSelectionMapper;
import pers.vic.practice.module.student.model.SCourseSelection;
import pers.vic.practice.module.student.model.SScore;

import javax.annotation.Resource;

/**
 * @description:选课表 Service
 * @author Vic.xu
 * @date: 2022-04-12 09:56
 */
@Service
public class SCourseSelectionService extends BaseService<SCourseSelectionMapper, SCourseSelection> {

    @Resource
    private SScoreService sScoreService;

    @Override
    protected boolean hasAttachment() {
        return false;
    }

    /**
     * 检测是否重复
     */
    public boolean checkRepeat(Integer id, Integer courseId, String number) {
        return mapper.checkRepeat(id, courseId, number);
    }

    /**
     * 保存整个班级的选课：这个班级中没有选这个课程的学生则为其选课
     */
    public int saveClasses(Integer classesId, Integer courseId) {
        return mapper.saveClasses(classesId, courseId);

    }

}
